package com.xgxx.chendawei.system.utils.api;

import com.xgxx.chendawei.enums.ApiResponseEnum;

public class BusinessException extends RuntimeException {

    private Integer code;


    public BusinessException() {
        this.code = ApiResponseEnum.DEFAULT_ERROR.getCode();
    }

    public BusinessException(Integer code) {
        this.code = code;
    }

    public BusinessException(String message, Integer code) {
        super(message);
        this.code = code;
    }

    public BusinessException(String message, Throwable cause, Integer code) {
        super(message, cause);
        this.code = code;
    }

    public BusinessException(Throwable cause, Integer code) {
        super(cause);
        this.code = code;
    }

    public BusinessException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Integer code) {
        super(message, cause, enableSuppression, writableStackTrace);
        this.code = code;
    }

    public BusinessException(String message) {
        super(message);
        this.code = ApiResponseEnum.DEFAULT_ERROR.getCode();
    }

    public BusinessException(String message, Throwable cause) {
        super(message, cause);
        this.code = ApiResponseEnum.DEFAULT_ERROR.getCode();
    }

    public BusinessException(Throwable cause) {
        super(cause);
        this.code = ApiResponseEnum.DEFAULT_ERROR.getCode();
    }

    public BusinessException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
        super(message, cause, enableSuppression, writableStackTrace);
        this.code = ApiResponseEnum.DEFAULT_ERROR.getCode();
    }

    public Integer getCode() {
        return code;
    }
}
